* more language stubs updates
authorMichael Dale <dale@users.mediawiki.org>
Mon, 5 Oct 2009 04:03:33 +0000 (04:03 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 5 Oct 2009 04:03:33 +0000 (04:03 +0000)
* mv_embed window.$mw updates
* fixed audio width for oggHandler rewrites via remote MwEmbed
* initial testing page to compare mediaWiki output to js output transformations
* sample test JS lang test files .. (probably temporary)

12 files changed:
js2/mwEmbed/jsScriptLoader.php
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/cldrConverter.php [deleted file]
js2/mwEmbed/php/clrdConverter.php [deleted file]
js2/mwEmbed/php/languages/cldrConverter.php [new file with mode: 0644]
js2/mwEmbed/php/languages/mwEmbed.i18n.php
js2/mwEmbed/php/noMediaWikiConfig.php
js2/mwEmbed/tests/testLang.html [new file with mode: 0644]
js2/mwEmbed/tests/testLangEn.js [new file with mode: 0644]
js2/mwEmbed/tests/testLangRU.js [new file with mode: 0644]
js2/remoteMwEmbed.js

index c0bfbb0..3cc5e2e 100644 (file)
@@ -300,6 +300,8 @@ class jsScriptLoader {
 
                // Do the language lookup
                if ( $jmsg ) {
+                       //see if any msgKey has the PLURAL template tag
+                       //package in PLURAL mapping
                        foreach ( $jmsg as $msgKey => $default_en_value ) {
                                $jmsg[$msgKey] = wfMsgNoTrans( $msgKey );
                        }
index 7b28872..bddf73b 100644 (file)
@@ -1404,11 +1404,11 @@ embedVideo.prototype = {
                this.thumbnail_disp = true;
        },
        refreshControlsHTML:function(){
-               js_log('refreshing controls HTML');
-               if($j('#mv_embedded_controls_'+this.id).length==0)
+               js_log('refreshControlsHTML::');
+               if($j('#mv_embedded_controls_'+this.id).length == 0)
                {
                        js_log('#mv_embedded_controls_'+this.id + ' not present, returning');
-                       return;
+                       return ;
                }else{
                        $j('#mv_embedded_controls_'+this.id).html( this.getControlsHTML() );
                        this.ctrlBuilder.addControlHooks(this);                                         
@@ -1427,7 +1427,7 @@ embedVideo.prototype = {
                                                'class="' + this.ctrlBuilder.pClass + '">';             
                html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;"  id="mv_embedded_player_'+this.id+'">' +
                                                this.getThumbnailHTML() + 
-                                       '</div>';                                                                                       
+                                       '</div>';                                                                       
                //js_log("mvEmbed:controls "+ typeof this.controls);                                                                    
                if( this.controls )
                {
@@ -1435,7 +1435,7 @@ embedVideo.prototype = {
                        this.ctrlBuilder = new ctrlBuilder( this );
                        
                        js_log("f:getHTML:AddControls");
-                       html_code +='<div id="mv_embedded_controls_' + this.id + '" class="ui-widget ui-corner-bottom ui-state-default controls" >';
+                       html_code +='<div id="mv_embedded_controls_' + this.id + '" class="ui-widget ui-corner-bottom ui-state-default  controls" >';
                        html_code += this.getControlsHTML();       
                        html_code +='</div>';                           
                        //block out some space by encapulating the top level div 
index 8acf477..131e553 100644 (file)
@@ -70,15 +70,14 @@ parseUri.options = {
 // For use when mv_embed with script-loader is in the root MediaWiki path
 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
 
-
 var _global = this; // Global obj
 
 /*
 * setup the empty global $mw object 
 * will ensure all our functions are properly namespaced
 */
-if(!_global['$mw']){
-       _global['$mw'] = {}
+if(!window['$mw']){
+       window['$mw'] = {}
 }
 
 //@@todo move these into $mw
@@ -91,26 +90,29 @@ var global_req_cb = new Array(); // The global request callback array
 if( !mv_embed_path ) {
        var mv_embed_path = getMvEmbedPath();
 }
-
-
-/*
-* Language classes $mw.lang
-* 
-* Localized Language suport attempts to mirror the functionality of Language.php in MediaWiki
-* It contains methods for loading and transforming msg text
-* 
-* code style:: 
-*      We could wrap each $mw extend in (function( $ ) { //functions here })($mw); and refrence $mw as $
+/**
+* wrap the global $mw object here:
+*
+* Any global functions/classes that are not jQuery plugins should make
+* there way into the $mw namespace 
 */
 (function( $ ) {
+       /*
+       * Language classes $mw.lang
+       * 
+       * Localized Language support attempts to mirror the functionality of Language.php in MediaWiki
+       * It contains methods for loading and transforming msg text
+       * 
+       */
        $.lang = {};
        /**
        * Setup the lang object
        */
        var gMsg = {};
+       var gRuleSet = {};
        /**
        * loadGM function
-       * Loads a set of json messeges into the lang object. 
+       * Loads a set of json messages into the lang object. 
        *
        * @param json msgSet The set of msgs to be loaded 
        */
@@ -119,6 +121,18 @@ if( !mv_embed_path ) {
                        gMsg[ i ] = msgSet[i];
                }
        },
+       /**
+       * loadRS function
+       * Loads a ruleset by given template key ie PLURAL : { //ruleSetObj }
+       *
+       * @param json ruleSet The ruleset object ( extends  gRuleSet )
+       */
+       $.lang.loadRS = function( ruleSet ){
+               for( var i in ruleSet){
+                       gRuleSet[ i ] = ruleSet[ i ];
+               }
+       }
+       
        /**
         * Returns a transformed msg string
         *
@@ -131,12 +145,14 @@ if( !mv_embed_path ) {
         * @return string 
         */
        $.lang.gM = function( key , args ) {
-               var ms = '';
-               if ( key in gMsg ) {
+               var supportedMagicLang = ['PLURAL'];
+                                               
+               if ( gMsg[ key ] ) {
+                       var ms = '';
+                       //get the messege string:
                        ms = gMsg[ key ];
-                       //test if we have a special replacement template call
-                       
                        
+                       //replace values 
                        if( typeof args == 'object' || typeof args == 'array' ) {
                                for( var v in args ) { 
                                        // Message test replace arguments start at 1 instead of zero:
@@ -146,12 +162,84 @@ if( !mv_embed_path ) {
                        } else if( typeof args =='string' || typeof args =='number' ) {
                                ms = ms.replace(/\$1/, args);
                        }
-                       return ms;
+                       
+                       //a quick check to see if we need to send the msg via the 'parser'
+                       //(we can add more detailed check once we suport more wiki syntax)
+                       if(ms.indexOf('{{')==-1)
+                               return ms;
+                               
+                       //send the msg key through the parser  
+                       pObj = $.parse( ms );
+                       //return the transformed msg
+                       return pObj.getHTML(); 
+
                } else {
                        // Missing key placeholder
                        return '&lt;' + key + '&gt;';
                }
-       },
+       }
+       /**
+       * Process a special language template (ie PLURAL )
+       */
+       $.lang.procLangTemp = function( tObj ){
+       
+               /* local lang templates: */             
+               function procPLURAL(){
+                       //Plural matchRuleTest
+                       function matchRuleTest(cRule, val){
+                               js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
+                               //check for simple cRule type:
+                               if( typeof cRule == 'number'){                                  
+                                       return ( parseInt( val ) == parseInt( cRule) );                                 
+                               }
+                       }
+                       //maps a given rule Index to template params: 
+                       function getTempParamFromRuleInx( ruleInx ){
+                               //in general this is a one to one mapping:
+                                
+                               js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
+                               var cat = tObj;
+                               debugger;
+                               return tObj.param[ ruleInx ];
+                       }
+                       
+                       //setup shortcuts
+                       var rs = gRuleSet['PLURAL'];    
+                       var val = tObj.val;             
+                       for(var ruleInx in rs){
+                               cRule = rs[ruleInx];
+                               if( matchRuleTest( cRule, val )){
+                                       js_log("matched rule: " + ruleInx );
+                                       return getTempParamFromRuleInx( ruleInx );                                      
+                               }
+                       }                       
+                       js_log('no match found for: ' + val + ' using last/other : ' +  tObj.param [ tObj.param.length -1 ] );
+                       //return the last /"other" template param 
+                       return tObj.param [ tObj.param.length -1 ];                                     
+               }
+               
+               /*
+               * Master rule switch statement
+               */
+               switch( tObj.n ){
+                       case 'PLURAL':
+                               return procPLURAL();
+                       break;
+               }
+       }
+       /**
+       * gMsgNoTrans
+       * 
+       * @returns string The msg key without transforming it
+       */
+       $.lang.gMsgNoTrans = function( key ){
+               if( gMsg[ key ] )
+                       return gMsg[ key ]
+       
+               // Missing key placeholder
+               return '&lt;' + key + '&gt;';
+       }
+       
        /**
         * gMsgLoadRemote loads remote msg strings
         * 
@@ -187,7 +275,7 @@ if( !mv_embed_path ) {
                        }
                        callback();
                });
-       },
+       }
        /**
         * Format a size in bytes for output, using an appropriate
         * unit (B, KB, MB or GB) according to the magnitude in question
@@ -223,16 +311,75 @@ if( !mv_embed_path ) {
                //@@todo we need a formatNum and we need to request some special packaged info to deal with that case.
                return gM( msg , size );
        }
-})($mw);
+       
+       
+       /**
+       * MediaWiki wikitext "Parser"
+       *
+       * This is not feature complete but we need a way to get at template properties 
+       *
+       * Template parsing is based in part on Magnus initial version: en:User:Magnus_Manske/tmpl.js
+       *  
+       * @param wikiText the wikitext to be parsed
+       * @return parserObj returns a parser object that has methods for getting at 
+       * things you would want 
+       */
+       $.parse = function( wikiText, opt ){
+               var parseObj = function( wikiText, opt){
+                       return this.init( wikiText, opt )
+               }               
+               parseObj.prototype = {
+                       pObj : {}, //the parser object that stores the parsed element structure
+                       pOut : '', //the parser output string container 
+                       init  :function( wikiText ){
+                               this.wikiText = wikiText;
+                               this.parse();
+                       },
+                       parse : function(){
+                               //basic parser stores wikiText structure in pObj
+                               
+                               //tries to mirror Extension:Page Object Model
+                       },
+                       templates : function( name ){
+                               //get template objects (optionally get a set by its name) 
+                               //hard code for plural for now:  
+                               return [{
+                                       'n': 'PLURAL',
+                                       'val': '1',
+                                       'param': ['one','other']
+                               }];                             
+                       },
+                       doMagicExpand : function(){
+                               //expand all the templates
+                               tSet = this.templates();
+                               for(var tInx in tSet){
+                                       var tObj = tSet[ tInx ] ;
+                                       //@@todo replace PLURARL with tObj.n                                    
+                                       this.pOut = this.pOut.replace( /\{\{PLURAL[^\}]*\}\}/, 
+                                                               $.lang.procLangTemp(tObj) );                                    
+                               }                       
+                       },
+                       //returns the transformed wikitext
+                       getHTML : function(){
+                               //copy the wikiText into the output (where we will do replaces) 
+                               this.pOut = this.wikiText;
+                               this.doMagicExpand();
+                               return this.pOut;                               
+                       }
+               };
+               //return the parserObj
+               return new parseObj( wikiText, opt) ;
+       }
+       
+       
+})(window.$mw);
 //setup legacy global shortcuts: 
 var loadGM = $mw.lang.loadGM;
 var gM = $mw.lang.gM;
 
 
-
-
 // All default messages in [English] should be overwritten by the CMS language message system.
-loadGM({
+$mw.lang.loadGM({
        "mwe-loading_txt" : "loading <blink>...<\/blink>",
        "mwe-loading_title" : "Loading...",
        "mwe-size-gigabytes" : "$1 GB",
@@ -242,6 +389,8 @@ loadGM({
        "mwe-error_load_lib" : "Error: JavaScript $1 was not retrievable or does not define $2"
 });
 
+
+
 /**
  * AutoLoader paths (this should mirror the file: jsAutoloadLocalClasses.php )
  * Any file _not_ listed here won't be auto-loadable
@@ -1013,7 +1162,7 @@ function mv_jqueryBindings() {
 /*
 * Utility functions:
 */
-// Simple URL rewriter (could probably be refactored into an inline regular expresion)
+// Simple URL rewriter (could probably be refactored into an inline regular exp)
 function getURLParamReplace( url, opt ) {
        var pSrc = parseUri( url );
        if( pSrc.protocol != '' ) {
@@ -1185,7 +1334,7 @@ function mwGetLocalApiUrl( url ) {
        }
        return false;
 }
-// Grab wiki form error for wiki html page proccessing (should be deprecated)
+// Grab wiki form error for wiki html page processing (should be deprecated because we use api now)
 function grabWikiFormError( result_page ) {
                var res = {};
                sp = result_page.indexOf( '<span class="error">' );
@@ -1234,7 +1383,7 @@ function do_request( req_url, callback ) {
        } else {
                // Get data via DOM injection with callback
                global_req_cb.push( callback );
-               // Prepend json_ to feed_format if not already requesting json format
+               // Prepend json_ to feed_format if not already requesting json format (metavid specific) 
                if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 )
                        req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );
                loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) );
diff --git a/js2/mwEmbed/php/cldrConverter.php b/js2/mwEmbed/php/cldrConverter.php
deleted file mode 100644 (file)
index de8b209..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/*
- * cldr format tries to build a structured representation of
- * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
- *
- * it has structure similar to
- * http://www.unicode.org/repos/cldr/tags/release-1-7-1/common/supplemental/plurals.xml
- *
- * It works by mapping array indexes to forms passed in via the PLURAL call
- * the plural types are linear mapped to PLURAL argument index.
- *
- * Rules should come in the following order:
- *  zero, one, two, few, many, other (other is a special default case that applies to all)
- *
- * cldr also allows export of rule sets in json to associated javascript
- */
-
-class cldrConverter {
-       static $masterCLDR = array(
-               // if locale is known to have no plurals, there are no rules
-               array(
-                       'locales'=> array('az','fa','hu','ja','ko','my to','tr','vi','yo','zh',
-                                                               'bo','dz','id','jv ka','km','kn','ms','th')
-               ),
-               array(
-                       'locales'=> array('ar'),
-                       'rules' => array(
-                               'zero'  => 0,
-                               'one'   => 1,
-                               'two'   => 2,
-                               //n mod 100 in 3..10
-                               'few'   => array( 'mod' => 100, 'is'=>'3-10' ),
-                               //n mod 100 in 11..99
-                               'many'  => array( 'mod' => 100, 'is'=>'11-99')
-                       )
-               ),
-               array( 'locales' => array(      'da','de','el','en','eo','es','et','fi','fo','gl',
-                                                                       'he','iw','it','nb','nl','nn','no','pt_PT','sv',
-                                                                       'af','bg','bn','ca','eu','fur','fy','gu','ha',
-                                                                       'is','ku','lb','ml','mr','nah','ne','om','or',
-                                                                       'pa','pap','ps','so','sq','sw','ta','te','tk',
-                                                                       'ur','zu','mn','gsw'),
-                               'rules' => array(
-                                       'one' => 1
-                               )
-               ),
-               array(  'locales' => array('pt','am','bh','fil','tl','guw','hi','ln','mg','nso','ti','wa'),
-                               'rules'=> array(
-                                       'one'=> '0-1'
-                               )
-               ),
-               array(  'locales' => array('fr'),
-                               'rules'=>array(
-                                       //n within 0..2 and n is not 2
-                                       'one' => array( 'is'=>'0-2', 'not' => 2)
-                               )
-               ),
-               array(  'locales' => array('lv'),
-                               'rules' => array(
-                                       'zero' => 0,
-                                       //n mod 10 is 1 and n mod 100 is not 11
-                                       'one'=>array(
-                                                       array( 'mod' => 10, 'is' => 1 ),
-                                                       //AND
-                                                       array( 'mod' => 100, 'not' => 11)
-                                               )
-                               )
-               ),
-               array(  'locales' => array('ga','se','sma','smi','smj','smn','sms'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'two' => 2
-                               )
-               ),
-               array(  'locales' => array('ro','mo'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       //n is 0 OR n is not 1 AND n mod 100 in 1..19
-                                       'few' => array(
-                                                               array( 'is' => 0),
-                                                               'or',
-                                                               array(
-                                                                       array( 'not' => 1),
-                                                                       array( 'mod' => 100, 'is'=>'1-19')
-                                                               )
-                                                       )
-                               )
-               ),
-               array(  'locales' => array( 'lt' ),
-                               'rules' => array(
-                                       //n mod 10 is 1 and n mod 100 not in 11..19
-                                       'one' => array(
-                                                               array( 'mod'=>10, 'is'=> 1 ),
-                                                               array( 'mod'=> 100, 'not'=> '11-19')
-                                                       ),
-                                       //n mod 10 in 2..9 and n mod 100 not in 11..19
-                                       'few' => array(
-                                                               array( 'mod'=> 10, 'is'=> '2-9' ),
-                                                               array( 'mod'=> 100, 'not' => '11-19')
-                                                       ),
-                               )
-               ),
-               array(  'locales' => array( 'hr','ru','sr','uk','be','bs','sh' ),
-                               'rules' => array(
-                                       //n mod 10 is 1 and n mod 100 is not 11
-                                       'one' => array(
-                                               array( 'mod' => 10, 'is' => 1),
-                                               array( 'mod' => 100, 'not' => 11)
-                                       ),
-                                       //n mod 10 in 2..4 and n mod 100 not in 12..14
-                                       'few' => array(
-                                               array( 'mod' => 10, 'is' => '2-4'),
-                                               array( 'mod' => 100, 'not' => '12-14')
-                                       ),
-                                       //n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14
-                                       'many' => array(
-                                               array( 'mod'=> 10, 'is' => 0),
-                                               'or',
-                                               array( 'mod'=> 10, 'is' => '5-9'),
-                                               'or',
-                                               array( 'mod'=> 100, 'is' => '11-14')
-                                       ),
-                               )
-               ),
-               array(  'locales' => array('cs','sk'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'few'=> '2-4'
-                               )
-               ),
-               array(  'locales' => array('pl'),
-                               'rules '=> array(
-                                       'one' => 1,
-                                       'few' => array(
-                                               //n mod 10 in 2..4
-                                               array( 'mod' => 10, 'is' => '2-4'),
-                                               //and n mod 100 not in 12..14
-                                               array( 'mod' => 100, 'not'=> '12-14'),
-                                               //and n mod 100 not in 22..24
-                                               array( 'mod' => 100, 'in' => '22-24')
-                                       )
-                               )
-               ),
-               array(  'locales' => array('sl'),
-                               'rules' => array(
-                                       'one' => array( 'mod'=>100, 'is' => 1 ),
-                                       'two' => array( 'mod'=>100, 'is' => 2 ),
-                                       'few' => array( 'mod'=>100, 'is' => '3-4')
-                               )
-               ),
-               array(  'locales' => array('mt'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       //n is 0 or n mod 100 in 2..10
-                                       'few' => array(
-                                               array( 'is' => 0 ),
-                                               'or',
-                                               array( 'mod' => 100, 'is' => '2-10')
-                                       ),
-                                       //n mod 100 in 11..19
-                                       'many' => array( 'mod'=>100, 'is' => '11-19')
-                               )
-               ),
-               array(  'locales' => array( 'mk' ),
-                               'rules' => array(
-                                       'one' => array('mod' => 10, 'is' => '1')
-                               )
-               ),
-               array(  'locales' => array( 'cy' ),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'two' => 2,
-                                       //n is 8 or n is 11
-                                       'many' => array(
-                                               array( 'is' => 8 ),
-                                               array( 'is' => 11 )
-                                       )
-                               )
-               )
-       );
-       //takes the cldr representation and returns the proper form
-       function cldrConvertPlural($count, $forms){
-               if ( !count($forms) ) { return ''; }
-               //get the rule set
-               $ruleSet = $this->getCldrRuleSet();
-               //get the number of forms (ruleSet Count + 1 for 'other' )
-               $fomsCount = count( $ruleSet ) + 1;
-
-               //if count is 1 no plurals for this language:
-               if( count( $forms ) == 1)
-                       return $forms[0];
-
-               $forms = $this->preConvertPlural( $forms, $fomsCount );
-
-       }
-
-       function getCldrRuleSet(){
-               $code = $this->getCode();
-               foreach($this->masterCLDR as $ruleSet){
-                       if( in_array($code, $ruleSet['locales']) ){
-                               return $ruleSet['rules'];
-                       }
-               }
-               //could not find the language code
-               return false;
-       }
-}
\ No newline at end of file
diff --git a/js2/mwEmbed/php/clrdConverter.php b/js2/mwEmbed/php/clrdConverter.php
deleted file mode 100644 (file)
index b77e5a2..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/*
- * cldr format tries to build a structured representation of
- * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
- *
- * it has structure similar to
- * http://www.unicode.org/repos/cldr/tags/release-1-7-1/common/supplemental/plurals.xml
- *
- * It works by mapping array indexes to forms passed in via the PLURAL call
- * the plural types are linear mapped to PLURAL argument index.
- *
- * Rules should come in the following order:
- *  zero, one, two, few, many, other (other is a special default case that applies to all)
- *
- * clrd also allows export of rule sets in json to associated javascript intepretation
- */
-
-class clrdConverter {
-       static $masterCLDR = array(
-               // if locale is known to have no plurals, there are no rules
-               array(
-                       'locales'=> array('az','fa','hu','ja','ko','my to','tr','vi','yo','zh',
-                                                               'bo','dz','id','jv ka','km','kn','ms','th')
-               ),
-               array(
-                       'locales'=> array('ar'),
-                       'rules' => array(
-                               'zero'  => 0,
-                               'one'   => 1,
-                               'two'   => 2,
-                               //n mod 100 in 3..10
-                               'few'   => array( 'mod' => 100, 'is'=>'3-10' ),
-                               //n mod 100 in 11..99
-                               'many'  => array( 'mod' => 100, 'is'=>'11-99')
-                       )
-               ),
-               array( 'locales' => array(      'da','de','el','en','eo','es','et','fi','fo','gl',
-                                                                       'he','iw','it','nb','nl','nn','no','pt_PT','sv',
-                                                                       'af','bg','bn','ca','eu','fur','fy','gu','ha',
-                                                                       'is','ku','lb','ml','mr','nah','ne','om','or',
-                                                                       'pa','pap','ps','so','sq','sw','ta','te','tk',
-                                                                       'ur','zu','mn','gsw'),
-                               'rules' => array(
-                                       'one' => 1
-                               )
-               ),
-               array(  'locales' => array('pt','am','bh','fil','tl','guw','hi','ln','mg','nso','ti','wa'),
-                               'rules'=> array(
-                                       'one'=> '0-1'
-                               )
-               ),
-               array(  'locales' => array('fr'),
-                               'rules'=>array(
-                                       //n within 0..2 and n is not 2
-                                       'one' => array( 'is'=>'0-2', 'not' => 2)
-                               )
-               ),
-               array(  'locales' => array('lv'),
-                               'rules' => array(
-                                       'zero' => 0,
-                                       //n mod 10 is 1 and n mod 100 is not 11
-                                       'one'=>array(
-                                                       array( 'mod' => 10, 'is' => 1 ),
-                                                       //AND
-                                                       array( 'mod' => 100, 'not' => 11)
-                                               )
-                               )
-               ),
-               array(  'locales' => array('ga','se','sma','smi','smj','smn','sms'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'two' => 2
-                               )
-               ),
-               array(  'locales' => array('ro','mo'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       //n is 0 OR n is not 1 AND n mod 100 in 1..19
-                                       'few' => array(
-                                                               array( 'is' => 0),
-                                                               'or',
-                                                               array(
-                                                                       array( 'not' => 1),
-                                                                       array( 'mod' => 100, 'is'=>'1-19')
-                                                               )
-                                                       )
-                               )
-               ),
-               array(  'locales' => array( 'lt' ),
-                               'rules' => array(
-                                       //n mod 10 is 1 and n mod 100 not in 11..19
-                                       'one' => array(
-                                                               array( 'mod'=>10, 'is'=> 1 ),
-                                                               array( 'mod'=> 100, 'not'=> '11-19')
-                                                       ),
-                                       //n mod 10 in 2..9 and n mod 100 not in 11..19
-                                       'few' => array(
-                                                               array( 'mod'=> 10, 'is'=> '2-9' ),
-                                                               array( 'mod'=> 100, 'not' => '11-19')
-                                                       ),
-                               )
-               ),
-               array(  'locales' => array( 'hr','ru','sr','uk','be','bs','sh' ),
-                               'rules' => array(
-                                       //n mod 10 is 1 and n mod 100 is not 11
-                                       'one' => array(
-                                               array( 'mod' => 10, 'is' => 1),
-                                               array( 'mod' => 100, 'not' => 11)
-                                       ),
-                                       //n mod 10 in 2..4 and n mod 100 not in 12..14
-                                       'few' => array(
-                                               array( 'mod' => 10, 'is' => '2-4'),
-                                               array( 'mod' => 100, 'not' => '12-14')
-                                       ),
-                                       //n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14
-                                       'many' => array(
-                                               array( 'mod'=> 10, 'is' => 0),
-                                               'or',
-                                               array( 'mod'=> 10, 'is' => '5-9'),
-                                               'or',
-                                               array( 'mod'=> 100, 'is' => '11-14')
-                                       ),
-                               )
-               ),
-               array(  'locales' => array('cs','sk'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'few'=> '2-4'
-                               )
-               ),
-               array(  'locales' => array('pl'),
-                               'rules '=> array(
-                                       'one' => 1,
-                                       'few' => array(
-                                               //n mod 10 in 2..4
-                                               array( 'mod' => 10, 'is' => '2-4'),
-                                               //and n mod 100 not in 12..14
-                                               array( 'mod' => 100, 'not'=> '12-14'),
-                                               //and n mod 100 not in 22..24
-                                               array( 'mod' => 100, 'in' => '22-24')
-                                       )
-                               )
-               ),
-               array(  'locales' => array('sl'),
-                               'rules' => array(
-                                       'one' => array( 'mod'=>100, 'is' => 1 ),
-                                       'two' => array( 'mod'=>100, 'is' => 2 ),
-                                       'few' => array( 'mod'=>100, 'is' => '3-4')
-                               )
-               ),
-               array(  'locales' => array('mt'),
-                               'rules' => array(
-                                       'one' => 1,
-                                       //n is 0 or n mod 100 in 2..10
-                                       'few' => array(
-                                               array( 'is' => 0 ),
-                                               'or',
-                                               array( 'mod' => 100, 'is' => '2-10')
-                                       ),
-                                       //n mod 100 in 11..19
-                                       'many' => array( 'mod'=>100, 'is' => '11-19')
-                               )
-               ),
-               array(  'locales' => array( 'mk' ),
-                               'rules' => array(
-                                       'one' => array('mod' => 10, 'is' => '1')
-                               )
-               ),
-               array(  'locales' => array( 'cy' ),
-                               'rules' => array(
-                                       'one' => 1,
-                                       'two' => 2,
-                                       //n is 8 or n is 11
-                                       'many' => array(
-                                               array( 'is' => 8 ),
-                                               array( 'is' => 11 )
-                                       )
-                               )
-               )
-       );
-       //takes the cldr representation and returns the proper form
-       function cldrConvertPlural($count, $forms){
-               if ( !count($forms) ) { return ''; }
-               //get the rule set
-               $ruleSet = $this->getCldrRuleSet();
-               //get the number of forms (ruleSet Count + 1 for 'other' )
-               $fomsCount = count( $ruleSet ) + 1;
-
-               //if count is 1 no plurals for this language:
-               if( count( $forms ) == 1)
-                       return $forms[0];
-
-               $forms = $this->preConvertPlural( $forms, $fomsCount );
-
-       }
-
-       function getCldrRuleSet(){
-               $code = $this->getCode();
-               foreach($this->masterCLDR as $ruleSet){
-                       if( in_array($code, $ruleSet['locales']) ){
-                               return $ruleSet['rules'];
-                       }
-               }
-               //could not find the language code
-               return false;
-       }
-}
\ No newline at end of file
diff --git a/js2/mwEmbed/php/languages/cldrConverter.php b/js2/mwEmbed/php/languages/cldrConverter.php
new file mode 100644 (file)
index 0000000..612f4ca
--- /dev/null
@@ -0,0 +1,203 @@
+<?php
+/*
+ * cldr format tries to build a structured representation of
+ * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
+ *
+ * it has structure similar to
+ * http://www.unicode.org/repos/cldr/tags/release-1-7-1/common/supplemental/plurals.xml
+ *
+ * It works by mapping array indexes to forms passed in via the PLURAL call
+ * the plural types are linear mapped to PLURAL argument index.
+ *
+ * Rules should come in the following order:
+ *  zero, one, two, few, many, other (other is a special default case that applies to all)
+ *
+ * cldr also allows export of rule sets in json to associated javascript
+ */
+class cldrConverter {
+       static $masterCLDR = array(
+               // if locales is known to have no plurals, there are no rules
+               array(
+                       'locales'=> array('az','fa','hu','ja','ko','my to','tr','vi','yo','zh',
+                                                               'bo','dz','id','jv ka','km','kn','ms','th')
+               ),
+               array(
+                       'locales'=> array('ar'),
+                       'rules' => array(
+                               'zero'  => 0,
+                               'one'   => 1,
+                               'two'   => 2,
+                               //n mod 100 in 3..10
+                               'few'   => array( 'mod' => 100, 'is'=>'3-10' ),
+                               //n mod 100 in 11..99
+                               'many'  => array( 'mod' => 100, 'is'=>'11-99')
+                       )
+               ),
+               array( 'locales' => array(      'da','de','el','en','eo','es','et','fi','fo','gl',
+                                                                       'he','iw','it','nb','nl','nn','no','pt_PT','sv',
+                                                                       'af','bg','bn','ca','eu','fur','fy','gu','ha',
+                                                                       'is','ku','lb','ml','mr','nah','ne','om','or',
+                                                                       'pa','pap','ps','so','sq','sw','ta','te','tk',
+                                                                       'ur','zu','mn','gsw'),
+                               'rules' => array(
+                                       'one' => 1
+                               )
+               ),
+               array(  'locales' => array('pt','am','bh','fil','tl','guw','hi','ln','mg','nso','ti','wa'),
+                               'rules'=> array(
+                                       'one'=> '0-1'
+                               )
+               ),
+               array(  'locales' => array('fr'),
+                               'rules'=>array(
+                                       //n within 0..2 and n is not 2
+                                       'one' => array( 'is'=>'0-2', 'not' => 2)
+                               )
+               ),
+               array(  'locales' => array('lv'),
+                               'rules' => array(
+                                       'zero' => 0,
+                                       //n mod 10 is 1 and n mod 100 is not 11
+                                       'one'=>array(
+                                                       array( 'mod' => 10, 'is' => 1 ),
+                                                       //AND
+                                                       array( 'mod' => 100, 'not' => 11)
+                                               )
+                               )
+               ),
+               array(  'locales' => array('ga','se','sma','smi','smj','smn','sms'),
+                               'rules' => array(
+                                       'one' => 1,
+                                       'two' => 2
+                               )
+               ),
+               array(  'locales' => array('ro','mo'),
+                               'rules' => array(
+                                       'one' => 1,
+                                       //n is 0 OR n is not 1 AND n mod 100 in 1..19
+                                       'few' => array(
+                                                               array( 'is' => 0),
+                                                               'or',
+                                                               array(
+                                                                       array( 'not' => 1),
+                                                                       array( 'mod' => 100, 'is'=>'1-19')
+                                                               )
+                                                       )
+                               )
+               ),
+               array(  'locales' => array( 'lt' ),
+                               'rules' => array(
+                                       //n mod 10 is 1 and n mod 100 not in 11..19
+                                       'one' => array(
+                                                               array( 'mod'=>10, 'is'=> 1 ),
+                                                               array( 'mod'=> 100, 'not'=> '11-19')
+                                                       ),
+                                       //n mod 10 in 2..9 and n mod 100 not in 11..19
+                                       'few' => array(
+                                                               array( 'mod'=> 10, 'is'=> '2-9' ),
+                                                               array( 'mod'=> 100, 'not' => '11-19')
+                                                       ),
+                               )
+               ),
+               array(  'locales' => array( 'hr','ru','sr','uk','be','bs','sh' ),
+                               'rules' => array(
+                                       //n mod 10 is 1 and n mod 100 is not 11
+                                       'one' => array(
+                                               array( 'mod' => 10, 'is' => 1),
+                                               array( 'mod' => 100, 'not' => 11)
+                                       ),
+                                       //n mod 10 in 2..4 and n mod 100 not in 12..14
+                                       'few' => array(
+                                               array( 'mod' => 10, 'is' => '2-4'),
+                                               array( 'mod' => 100, 'not' => '12-14')
+                                       ),
+                                       //n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14
+                                       'many' => array(
+                                               array( 'mod'=> 10, 'is' => 0),
+                                               'or',
+                                               array( 'mod'=> 10, 'is' => '5-9'),
+                                               'or',
+                                               array( 'mod'=> 100, 'is' => '11-14')
+                                       ),
+                               )
+               ),
+               array(  'locales' => array('cs','sk'),
+                               'rules' => array(
+                                       'one' => 1,
+                                       'few'=> '2-4'
+                               )
+               ),
+               array(  'locales' => array('pl'),
+                               'rules '=> array(
+                                       'one' => 1,
+                                       'few' => array(
+                                               //n mod 10 in 2..4
+                                               array( 'mod' => 10, 'is' => '2-4'),
+                                               //and n mod 100 not in 12..14
+                                               array( 'mod' => 100, 'not'=> '12-14'),
+                                               //and n mod 100 not in 22..24
+                                               array( 'mod' => 100, 'in' => '22-24')
+                                       )
+                               )
+               ),
+               array(  'locales' => array('sl'),
+                               'rules' => array(
+                                       'one' => array( 'mod'=>100, 'is' => 1 ),
+                                       'two' => array( 'mod'=>100, 'is' => 2 ),
+                                       'few' => array( 'mod'=>100, 'is' => '3-4')
+                               )
+               ),
+               array(  'locales' => array('mt'),
+                               'rules' => array(
+                                       'one' => 1,
+                                       //n is 0 or n mod 100 in 2..10
+                                       'few' => array(
+                                               array( 'is' => 0 ),
+                                               'or',
+                                               array( 'mod' => 100, 'is' => '2-10')
+                                       ),
+                                       //n mod 100 in 11..19
+                                       'many' => array( 'mod'=>100, 'is' => '11-19')
+                               )
+               ),
+               array(  'locales' => array( 'mk' ),
+                               'rules' => array(
+                                       'one' => array('mod' => 10, 'is' => '1')
+                               )
+               ),
+               array(  'locales' => array( 'cy' ),
+                               'rules' => array(
+                                       'one' => 1,
+                                       'two' => 2,
+                                       //n is 8 or n is 11
+                                       'many' => array(
+                                               array( 'is' => 8 ),
+                                               array( 'is' => 11 )
+                                       )
+                               )
+               )
+       );
+       //takes the cldr representation and returns the proper form
+       function cldrConvertPlural($count, $forms){
+               if ( !count($forms) ) { return ''; }
+               //get the rule set
+               $ruleSet = $this->getCldrRuleSet();
+               //get the number of forms (ruleSet Count + 1 for 'other' )
+               $fomsCount = count( $ruleSet ) + 1;
+
+               //if count is 1 no plurals for this language:
+               if( count( $forms ) == 1)
+                       return $forms[0];
+
+       }
+
+       static function getCldrRuleSet( $code ){
+               foreach(self::$masterCLDR as $ruleSet){
+                       if( in_array($code, $ruleSet['locales']) ){
+                               return $ruleSet['rules'];
+                       }
+               }
+               //could not find the language code
+               return false;
+       }
+}
\ No newline at end of file
index 3c236e7..92b70ef 100644 (file)
 $messages = array();
 
 $messages['en'] = array(
-       /*
-        * js file: /libClipEdit/mvClipEdit.js
-        */
-       'mwe-crop' => 'Crop image',
-       'mwe-apply_crop' => 'Apply crop to image',
-       'mwe-reset_crop' => 'Reset crop',
-       'mwe-insert_image_page' => 'Insert into page',
-       'mwe-insert_into_sequence' => 'Insert into sequence',
-       'mwe-preview_insert' => 'Preview insert',
-       'mwe-cancel_image_insert' => 'Cancel insert',
-       'mwe-sc_fileopts' => 'Clip detail edit',
-       'mwe-sc_inoutpoints' => 'Set in-out points',
-       'mwe-sc_overlays' => 'Overlays',
-       'mwe-sc_audio' => 'Audio control',
-       'mwe-sc_duration' => 'Duration',
-       'mwe-template_properties' => 'Template properties',
-       'mwe-custom_title' => 'Custom title',
-       'mwe-edit_properties' => 'Edit properties',
-       'mwe-other_properties' => 'Other properties',
-       'mwe-resource_page' => 'Resource page:',
-       'mwe-set_in_out_points' => 'Set in-out points',
-       'mwe-start_time' => 'Start time',
-       'mwe-end_time' => 'End time',
-       'mwe-preview_inout' => 'Preview in-out points',
-
        /*
         * js file: /libTimedText/mvTextInterface.js
         */
@@ -46,63 +21,54 @@ $messages['en'] = array(
        'mwe-no_text_tracks_found' => 'No text tracks were found',
 
        /*
-        * js file: /libSequencer/mvTimedEffectsEdit.js
+        * js file: /libAddMedia/mvBaseUploadInterface.js
         */
-       'mwe-transition_in' => 'Transition in',
-       'mwe-transition_out' => 'Transition out',
-       'mwe-effects' => 'Effects stack',
-       'mwe-remove_transition' => 'Remove transition',
-       'mwe-edit_transin' => 'Edit transition into clip',
-       'mwe-edit_transout' => 'Edit transition out of clip',
+       'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)',
+       'mwe-upload-in-progress' => 'Upload in progress (do not close this window)',
+       'mwe-upload-transcoded-status' => 'Transcoded',
+       'mwe-uploaded-status' => 'Uploaded',
+       'mwe-upload-stats-fileprogres' => '$1 of $2',
+       'mwe-upload_completed' => 'Your upload is complete',
+       'mwe-upload_done' => '<a href="$1">Your upload <i>should be</i> accessible</a>.',
+       'mwe-upload-unknown-size' => 'Unknown size',
+       'mwe-cancel-confim' => 'Are you sure you want to cancel?',
+       'mwe-successfulupload' => 'Upload successful',
+       'mwe-uploaderror' => 'Upload error',
+       'mwe-uploadwarning' => 'Upload warning',
+       'mwe-unknown-error' => 'Unknown error:',
+       'mwe-return-to-form' => 'Return to form',
+       'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:',
+       'mwe-fileexists' => 'A file with this name exists already. Please check <b><tt>$1</tt></b> if you are not sure if you want to change it.',
+       'mwe-fileexists-thumb' => '<center><b>Existing file</b></center>',
+       'mwe-ignorewarning' => 'Ignore warning and save file anyway',
+       'mwe-file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>',
+       'mwe-go-to-resource' => 'Go to resource page',
+       'mwe-upload-misc-error' => 'Unknown upload error',
+       'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">more information</a>).',
+       'mwe-cancel-button' => 'Cancel',
+       'mwe-ok-button' => 'OK',
 
        /*
-        * js file: /libSequencer/mvSequencer.js
+        * js file: /libAddMedia/mvAdvFirefogg.js
         */
-       'mwe-menu_clipedit' => 'Edit media',
-       'mwe-menu_transition' => 'Transitions and effects',
-       'mwe-menu_cliplib' => 'Add media',
-       'mwe-menu_resource_overview' => 'Resource overview',
-       'mwe-menu_options' => 'Options',
-       'mwe-loading_timeline' => 'Loading timeline <blink>...</blink>',
-       'mwe-loading_user_rights' => 'Loading user rights <blink>...</blink>',
-       'mwe-no_edit_permissions' => 'You do not have permissions to save changes to this sequence',
-       'mwe-edit_clip' => 'Edit clip',
-       'mwe-edit_save' => 'Save sequence changes',
-       'mwe-saving_wait' => 'Save in progress (please wait)',
-       'mwe-save_done' => 'Save complete',
-       'mwe-edit_cancel' => 'Cancel sequence edit',
-       'mwe-edit_cancel_confirm' => 'Are you sure you want to cancel your edit? Changes will be lost.',
-       'mwe-zoom_in' => 'Zoom in',
-       'mwe-zoom_out' => 'Zoom out',
-       'mwe-cut_clip' => 'Cut clips',
-       'mwe-expand_track' => 'Expand track',
-       'mwe-collapse_track' => 'Collapse track',
-       'mwe-play_from_position' => 'Play from playline position',
-       'mwe-pixle2sec' => 'pixels to seconds',
-       'mwe-rmclip' => 'Remove clip',
-       'mwe-clip_in' => 'clip in',
-       'mwe-clip_out' => 'clip out',
-       'mwe-welcome_to_sequencer' => '<h3>Welcome to the sequencer demo</h3> Very <b>limited</b> functionality right now. Not much documentation yet either.',
-       'mwe-no_selected_resource' => '<h3>No resource selected</h3> Select a clip to enable editing.',
-       'mwe-error_edit_multiple' => '<h3>Multiple resources selected</h3> Select a single clip to edit it.',
-       'mwe-editor_options' => 'Editor options',
-       'mwe-editor_mode' => 'Editor mode',
-       'mwe-simple_editor_desc' => 'simple editor (iMovie style)',
-       'mwe-advanced_editor_desc' => 'advanced editor (Final Cut style)',
-       'mwe-other_options' => 'Other options',
-       'mwe-contextmenu_opt' => 'Enable context menus',
-       'mwe-sequencer_credit_line' => 'Developed by <a href="http://kaltura.com">Kaltura, Inc.</a> in partnership with the <a href="http://wikimediafoundation.org/wiki/Home">Wikimedia Foundation</a> (<a href="#">more information</a>).',
+       'fogg-help-sticky' => 'Help (click to stick)',
+       'fogg-cg-preset' => 'Preset: <strong>$1</strong>',
+       'fogg-cg-quality' => 'Basic quality and resolution control',
+       'fogg-cg-meta' => 'Metadata for the clip',
+       'fogg-cg-range' => 'Encoding range',
+       'fogg-cg-advVideo' => 'Advanced video encoding controls',
+       'fogg-cg-advAudio' => 'Advanced audio encoding controls',
+       'fogg-preset-custom' => 'Custom settings',
 
        /*
-        * js file: /mv_embed.js
+        * js file: /libAddMedia/searchLibs/metavidSearch.js
         */
-       'mwe-loading_txt' => 'loading <blink>...</blink>',
-       'mwe-loading_title' => 'Loading...',
-       'mwe-size-gigabytes' => '$1 GB',
-       'mwe-size-megabytes' => '$1 MB',
-       'mwe-size-kilobytes' => '$1 K',
-       'mwe-size-bytes' => '$1 B',
-       'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2',
+       'mwe-stream_title' => '$1 $2 to $3',
+
+       /*
+        * js file: /libAddMedia/searchLibs/baseRemoteSearch.js
+        */
+       'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.',
 
        /*
         * js file: /libAddMedia/mvFirefogg.js
@@ -124,26 +90,16 @@ $messages['en'] = array(
        'fogg-hidepreview' => 'Hide preview',
 
        /*
-        * js file: /libAddMedia/searchLibs/baseRemoteSearch.js
-        */
-       'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.',
-
-       /*
-        * js file: /libAddMedia/searchLibs/metavidSearch.js
-        */
-       'mwe-stream_title' => '$1 $2 to $3',
-
-       /*
-        * js file: /libAddMedia/mvAdvFirefogg.js
+        * js file: /libAddMedia/simpleUploadForm.js
         */
-       'fogg-help-sticky' => 'Help (click to stick)',
-       'fogg-cg-preset' => 'Preset: <strong>$1</strong>',
-       'fogg-cg-quality' => 'Basic quality and resolution control',
-       'fogg-cg-meta' => 'Metadata for the clip',
-       'fogg-cg-range' => 'Encoding range',
-       'fogg-cg-advVideo' => 'Advanced video encoding controls',
-       'fogg-cg-advAudio' => 'Advanced audio encoding controls',
-       'fogg-preset-custom' => 'Custom settings',
+       'mwe-select_file' => 'Select file',
+       'mwe-more_licence_options' => 'For more licence options, view the <a href="$1">normal upload page</a>',
+       'mwe-select_ownwork' => 'I am uploading entirely my own work, and licencing it under:',
+       'mwe-licence_cc-by-sa' => 'Creative Commons Share Alike (3.0)',
+       'mwe-upload' => 'Upload file',
+       'mwe-destfilename' => 'Destination filename:',
+       'mwe-summary' => 'Summary',
+       'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.',
 
        /*
         * js file: /libAddMedia/remoteSearchDriver.js
@@ -186,44 +142,52 @@ $messages['en'] = array(
        'mwe-preview_insert_resource' => 'Preview insert of resource: $1',
 
        /*
-        * js file: /libAddMedia/simpleUploadForm.js
+        * js file: /libSequencer/mvSequencer.js
         */
-       'mwe-select_file' => 'Select file',
-       'mwe-more_licence_options' => 'For more licence options, view the <a href="$1">normal upload page</a>',
-       'mwe-select_ownwork' => 'I am uploading entirely my own work, and licencing it under:',
-       'mwe-licence_cc-by-sa' => 'Creative Commons Share Alike (3.0)',
-       'mwe-upload' => 'Upload file',
-       'mwe-destfilename' => 'Destination filename:',
-       'mwe-summary' => 'Summary',
-       'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.',
+       'mwe-menu_clipedit' => 'Edit media',
+       'mwe-menu_transition' => 'Transitions and effects',
+       'mwe-menu_cliplib' => 'Add media',
+       'mwe-menu_resource_overview' => 'Resource overview',
+       'mwe-menu_options' => 'Options',
+       'mwe-loading_timeline' => 'Loading timeline <blink>...</blink>',
+       'mwe-loading_user_rights' => 'Loading user rights <blink>...</blink>',
+       'mwe-no_edit_permissions' => 'You do not have permissions to save changes to this sequence',
+       'mwe-edit_clip' => 'Edit clip',
+       'mwe-edit_save' => 'Save sequence changes',
+       'mwe-saving_wait' => 'Save in progress (please wait)',
+       'mwe-save_done' => 'Save complete',
+       'mwe-edit_cancel' => 'Cancel sequence edit',
+       'mwe-edit_cancel_confirm' => 'Are you sure you want to cancel your edit? Changes will be lost.',
+       'mwe-zoom_in' => 'Zoom in',
+       'mwe-zoom_out' => 'Zoom out',
+       'mwe-cut_clip' => 'Cut clips',
+       'mwe-expand_track' => 'Expand track',
+       'mwe-collapse_track' => 'Collapse track',
+       'mwe-play_from_position' => 'Play from playline position',
+       'mwe-pixle2sec' => 'pixels to seconds',
+       'mwe-rmclip' => 'Remove clip',
+       'mwe-clip_in' => 'clip in',
+       'mwe-clip_out' => 'clip out',
+       'mwe-welcome_to_sequencer' => '<h3>Welcome to the sequencer demo</h3> Very <b>limited</b> functionality right now. Not much documentation yet either.',
+       'mwe-no_selected_resource' => '<h3>No resource selected</h3> Select a clip to enable editing.',
+       'mwe-error_edit_multiple' => '<h3>Multiple resources selected</h3> Select a single clip to edit it.',
+       'mwe-editor_options' => 'Editor options',
+       'mwe-editor_mode' => 'Editor mode',
+       'mwe-simple_editor_desc' => 'simple editor (iMovie style)',
+       'mwe-advanced_editor_desc' => 'advanced editor (Final Cut style)',
+       'mwe-other_options' => 'Other options',
+       'mwe-contextmenu_opt' => 'Enable context menus',
+       'mwe-sequencer_credit_line' => 'Developed by <a href="http://kaltura.com">Kaltura, Inc.</a> in partnership with the <a href="http://wikimediafoundation.org/wiki/Home">Wikimedia Foundation</a> (<a href="#">more information</a>).',
 
        /*
-        * js file: /libAddMedia/mvBaseUploadInterface.js
+        * js file: /libSequencer/mvTimedEffectsEdit.js
         */
-       'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)',
-       'mwe-upload-in-progress' => 'Upload in progress (do not close this window)',
-       'mwe-upload-transcoded-status' => 'Transcoded',
-       'mwe-uploaded-status' => 'Uploaded',
-       'mwe-upload-stats-fileprogres' => '$1 of $2',
-       'mwe-upload_completed' => 'Your upload is complete',
-       'mwe-upload_done' => '<a href="$1">Your upload <i>should be</i> accessible</a>.',
-       'mwe-upload-unknown-size' => 'Unknown size',
-       'mwe-cancel-confim' => 'Are you sure you want to cancel?',
-       'mwe-successfulupload' => 'Upload successful',
-       'mwe-uploaderror' => 'Upload error',
-       'mwe-uploadwarning' => 'Upload warning',
-       'mwe-unknown-error' => 'Unknown error:',
-       'mwe-return-to-form' => 'Return to form',
-       'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:',
-       'mwe-fileexists' => 'A file with this name exists already. Please check <b><tt>$1</tt></b> if you are not sure if you want to change it.',
-       'mwe-fileexists-thumb' => '<center><b>Existing file</b></center>',
-       'mwe-ignorewarning' => 'Ignore warning and save file anyway',
-       'mwe-file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>',
-       'mwe-go-to-resource' => 'Go to resource page',
-       'mwe-upload-misc-error' => 'Unknown upload error',
-       'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">more information</a>).',
-       'mwe-cancel-button' => 'Cancel',
-       'mwe-ok-button' => 'OK',
+       'mwe-transition_in' => 'Transition in',
+       'mwe-transition_out' => 'Transition out',
+       'mwe-effects' => 'Effects stack',
+       'mwe-remove_transition' => 'Remove transition',
+       'mwe-edit_transin' => 'Edit transition into clip',
+       'mwe-edit_transout' => 'Edit transition out of clip',
 
        /*
         * js file: /libEmbedVideo/embedVideo.js
@@ -275,6 +239,42 @@ $messages['en'] = array(
        'mwe-read_before_embed' => 'Please read the <a href="http://mediawiki.org/wiki/Security_Notes_on_Remote_Embedding" target="_new">security notes on remote embedding</a> before acually embeding!',
        'mwe-embed_site_or_blog' => 'Embed on your site or blog',
        'mwe_related_videos' => 'Related videos',
+
+       /*
+        * js file: /libClipEdit/mvClipEdit.js
+        */
+       'mwe-crop' => 'Crop image',
+       'mwe-apply_crop' => 'Apply crop to image',
+       'mwe-reset_crop' => 'Reset crop',
+       'mwe-insert_image_page' => 'Insert into page',
+       'mwe-insert_into_sequence' => 'Insert into sequence',
+       'mwe-preview_insert' => 'Preview insert',
+       'mwe-cancel_image_insert' => 'Cancel insert',
+       'mwe-sc_fileopts' => 'Clip detail edit',
+       'mwe-sc_inoutpoints' => 'Set in-out points',
+       'mwe-sc_overlays' => 'Overlays',
+       'mwe-sc_audio' => 'Audio control',
+       'mwe-sc_duration' => 'Duration',
+       'mwe-template_properties' => 'Template properties',
+       'mwe-custom_title' => 'Custom title',
+       'mwe-edit_properties' => 'Edit properties',
+       'mwe-other_properties' => 'Other properties',
+       'mwe-resource_page' => 'Resource page:',
+       'mwe-set_in_out_points' => 'Set in-out points',
+       'mwe-start_time' => 'Start time',
+       'mwe-end_time' => 'End time',
+       'mwe-preview_inout' => 'Preview in-out points',
+
+       /*
+        * js file: /mv_embed.js
+        */
+       'mwe-loading_txt' => 'loading <blink>...</blink>',
+       'mwe-loading_title' => 'Loading...',
+       'mwe-size-gigabytes' => '$1 GB',
+       'mwe-size-megabytes' => '$1 MB',
+       'mwe-size-kilobytes' => '$1 K',
+       'mwe-size-bytes' => '$1 B',
+       'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2',
 );
 
 /** Message documentation (Message documentation)
index cf1024b..531e134 100644 (file)
@@ -24,6 +24,7 @@ $wgJSAutoloadLocalClasses = array();
 
 /*Localization:*/
 $wgEnableScriptLocalization = true;
+
 $mwLanguageCode = 'en';
 
 $wgContLanguageCode = '';
diff --git a/js2/mwEmbed/tests/testLang.html b/js2/mwEmbed/tests/testLang.html
new file mode 100644 (file)
index 0000000..b228e34
--- /dev/null
@@ -0,0 +1,62 @@
+<html>
+<head>
+<title>Test Plural Conversions (should match php) </title>
+<script type="text/javascript" src="../mv_embed.js"></script>
+<script type="text/javascript" src="testLangEn.js"></script>
+<style>
+td{
+       border:solid thin black;
+}
+</style>
+<script type="text/javascript" >
+       var langKey = 'en';
+js2AddOnloadHook( function(){
+               //build table output: 
+               var o = '<table>';
+               var msgTestSet = [ 'test_plural_msg', 'undelete_short' ];
+               var testNumberSet = [ 0, 1, 2, 5, 21, 22, 30 ];                         
+               //now for each langage msg: 
+               $j.each(msgTestSet, function(inx, mKey){
+                       //output table names:
+                       o+='<tr>'+
+                                       '<td>$1:</td>'+
+                                       '<td>Msg key</td>'+
+                                       '<td>Msg text</td>'+
+                                       '<td>Msg Transform JS</td>'+
+                                       '<td>Msg Transform Mw</td>'+
+                               '</tr>';
+               
+                       //for each number value
+                       for(var i in testNumberSet){
+                               var numVal = testNumberSet[i];                                          
+                               o+='<tr>'+
+                                               '<td>' + numVal + '</td>' + 
+                                               '<td>' + mKey + '</td>' + 
+                                               '<td>' + $mw.lang.gMsgNoTrans( mKey ) + '</td>' + 
+                                               '<td>' + $mw.lang.gM( mKey, numVal ) + '</td>';
+                               //show mw col:                                          
+                               if( mKey.substr(0, 5) == 'test_' ){
+                                       o+='<td> (test msg) </td>';
+                               }else{  
+                                       o+='<td rel="' + mKey + '_' + numVal + '">loading<blink>...</blink></td>';
+                                       //get transform from mw (& compare and highlight) 
+                               } 
+                               o+='</tr>';                                                                             
+                       }
+                       //output a spacer:
+                       o+='<tr><td colspan="6" height="20"> </td></tr>';                       
+               });
+               o+='</table>';
+               //put the output into the page: 
+               $j('#table_out').html( o );
+});
+</script>
+</head>
+<body>
+<h3>Test Javascript plural msg transformations</h3>
+
+<div id="table_out"></div>
+
+
+</body>
+</html>
diff --git a/js2/mwEmbed/tests/testLangEn.js b/js2/mwEmbed/tests/testLangEn.js
new file mode 100644 (file)
index 0000000..d970ea6
--- /dev/null
@@ -0,0 +1,14 @@
+/* a simple language tester replacements
+
+ */
+
+loadGM({
+       //test msg with english words to see whats going on
+       'test_plural_msg' : '{{PLURAL:$1|one|other}}',
+       //sample real world msgs: 
+       'undelete_short'  : 'Undelete {{PLURAL:$1|one edit|$1 edits}}'
+});
+
+$mw.lang.loadRS({
+       'PLURAL' : { "one":1 }  
+});
\ No newline at end of file
diff --git a/js2/mwEmbed/tests/testLangRU.js b/js2/mwEmbed/tests/testLangRU.js
new file mode 100644 (file)
index 0000000..2772c39
--- /dev/null
@@ -0,0 +1,23 @@
+/* a simple language tester replacements
+
+ */
+
+loadGM({
+       //test msg with english words to see whats going on
+       'test_plural_msg' : '{{PLURAL:$1|one|few|many}}'
+       //sample real world msgs: 
+       'undelete_short'    => 'Восстановить $1 {{PLURAL:$1|правку|правки|правок}}',
+});
+loadRS({
+       'PLURAL' :
+               {
+               "one":[{"mod":10,"is":1},{"mod":100,"not":11}],
+               "few":[{"mod":10,"is":"2-4"},{"mod":100,"not":"12-14"}],
+               "many":[{"mod":10,"is":0},
+                               "or",
+                               {"mod":10,"is":"5-9"},
+                               "or",
+                               {"mod":100,"is":"11-14"}
+                               ]
+               }
+});
index 0f535cc..0b3a61a 100644 (file)
@@ -59,7 +59,8 @@ function rewrite_for_OggHandler( vidIdList ){
                var type_attr = '';
                // Check for audio
                if( pwidth == '22' && pheight == '22' ) {
-                       pwidth = '400';
+                       //set width to parent width:
+                       pwidth = $j( '#' + vidId ).width();
                        pheight = '100';
                        type_attr = 'type="audio/ogg"';
                        poster_attr = '';